<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>01-键盘事件</title>
</head>
<body>
    <input type="text">
    <script>
        /* 
            键盘事件
            1. keyup : 键盘弹起触发
            2. keydown : 键盘按下，一直触发  
            3. keypress : 键盘按下，一直触发 
            4. keypress : 不能触发功能键
        */
       document.addEventListener('keyup',function(){
           console.log('------keyup------');
       });
       document.addEventListener('keydown',function(){
           console.log('------keydown------');
       });
       document.addEventListener('keypress',function(){
           console.log('-------keypress-------');
       });
    </script>
</body>
</html>